/*
 * Copyright (c) 2006-2018, RT-Thread Development Team
 *
 * SPDX-License-Identifier: Apache-2.0
 *
 * Change Logs:
 * Date           Author       Notes
 * 2018-11-06     SummerGift   first version
 */

#include <rtthread.h>
#include <rtdevice.h>
#include <board.h>

#include "led_alert.h"
#include "key.h"
#include "air_sensor.h"

/* defined the LED0 pin: PA5 */
//#define LED0_PIN               GET_PIN(A, 5)

/* D9 --> PC7 */
#define LED_GP2Y_PIN       GET_PIN(C, 7)

int main(void)
{
    int count = 1;
    /* set LED0 pin mode to output */
	/*
    rt_pin_mode(LED0_PIN, PIN_MODE_OUTPUT);

    while (count++)
    {
        rt_pin_write(LED0_PIN, PIN_HIGH);
        rt_thread_mdelay(500);
        rt_pin_write(LED0_PIN, PIN_LOW);
        rt_thread_mdelay(500);
    }
	*/
	rt_kprintf("led_init()\n");
	led_init();
	rt_kprintf("key_init()\n");
	key_init();


	rt_pin_mode(LED_GP2Y_PIN, PIN_MODE_OUTPUT);
	led_off(LED_GP2Y_PIN);

	//temp_humi_init();
/*
	rt_kprintf("led_on()\n");
	led_on();

	rt_kprintf("led_off()\n");
	led_off();
*/

	while(count++)
	{
		//rt_kprintf("led_blink()\n");
		//led_blink_time(500);
		
		led_on(LED_GP2Y_PIN);
		rt_thread_mdelay(1000);
		led_off(LED_GP2Y_PIN);
	}



    return RT_EOK;
}
